FINANCE DATA PROJECT

This project we will focus on exploratory data analysis of stock prices. We'll focus on bank stocks and see how they progressed throughout the financial crisis all the way to early 2020.

Import necessary packages

In this exploratory data analysis, we will use pandas, numpy, datetime, matplotlib, seaborn, and pandas_datareader modules. These modules are preinstalled using pip.

Get the stock data

Using the pandas_datareader module, we will get the information for the following banks:

Take a look on the bank_stocks data.

Find the max close price for each bank's stock

Maximum closing price:

Minimum closing price:

Create a new empty DataFrame called returns. This df will contain the returns for each bank's stock.

Here is the brief overview of returns dataset.

Create a pairplot using seaborn of the returns dataframe.

Using the returns dataframe, figure out on what dates each bank stock had the best and worst single day returns.

Best single day returns:

Worst single day returns:

Take a look at the standard deviation of the returns. Which stock we classify as the riskiest over the time period? Which we would classify as the riskiest for the year 2015?

Standard Deviation of the returns over the time period.

Standard Deviation of the returns for the year 2019.

Stock return with highest deviation is considered the riskiest because the price of that particular stock has higher volatality compared to the other.

Create a distplot using seaborn of the 2015 for KeyGroup

Create a distplot using seaborn of the 2008 for CitiGroup

Imports

Now we will import plotly and cufflinks as additional visualization modules.

Create a line plot showing Close price for each bank.

The plot below shows the Closing price for each stock from 2006 to 2016. For the first graph, we use pandas built in plotting library while the second graph we use the plotly library.

Moving Averages

Plot the 30 day average against the Close Price for BofA stock for the year 2008

Create a heatmap of the correlation between the stock Close Price.

Create a candle plot of BofA stock from Jan 1st 2015 to Jan 1st 2016